package cn.wellwan.strategypattern;

/**
 * creator: maokai
 * on: 2018/3/26
 * description: 超类
 */
public abstract class Duck {
    protected FlyBehavior flyBehavior;
    protected QuackBehavior quackBehavior;


    public void setFlyBehavior (FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public void setQuackBehavior (QuackBehavior quackBehavior) {
        this.quackBehavior = quackBehavior;
    }

    public void swin () {
        System.out.println("游泳");
    }

    public void performQuack () {
        quackBehavior.quacking();
    }

    public void performFly () {
        flyBehavior.flying();
    }

    //颜色 给子类去完成自己的颜色
    public abstract void display ();
}
